<template>
  <div>
    <div style="display: flex;font-weight: bold;color: #000000;justify-content: center;font-size: 29px;padding: 20px">
      江西省地方标准征求意见处理汇总表
    </div>
    <div
      style="display: flex;font-weight: bold;color: #000000;justify-content: center;font-size: 21px;margin-bottom: 10px;">
      （试行）
    </div>
    <t-form labelAlign="top" ref="form" :data="formData"  class="step-form table-form"
            labelWidth="140px">
      <div style="display: flex;width: 100%;align-items: center;margin-bottom: 10px"><div>起草单位（盖章）：</div><div>{{ draftUnitId | filterByTree(deptMenuOptions) }}</div><div style="margin-left: 20px">汇总日期：</div><div><t-form-item name="collectDate">{{formData.collectDate}}
      </t-form-item></div></div>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>标准计划号</t-col>
        <t-col :span="4">
          <t-form-item name="planNum">
            {{ formData.planNum }}
          </t-form-item>
        </t-col>
        <t-col :span="2" class="title">标准名称</t-col>
        <t-col :span="4">
          <t-form-item name="projectName">
            {{ formData.projectName }}
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>技术归口单位</t-col>
        <t-col :span="10">
          标准委员会
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>意见分发和回收情况</t-col>
        <t-col :span="10" style="flex-direction: column">
          <t-row style="width: 100%">
            <t-col class="text-center" :flex="1">单位</t-col>
            <t-col class="text-center" :flex="1">政府部门</t-col>
            <t-col class="text-center" :flex="1">行业协会</t-col>
            <t-col class="text-center" :flex="1">企业</t-col>
            <t-col class="text-center" :flex="1">科研机构</t-col>
            <t-col class="text-center" :flex="1">检验检测机构</t-col>
            <t-col class="text-center" :flex="1">认证认可机构</t-col>
            <t-col class="text-center" :flex="1">消费者代表</t-col>
          </t-row>
          <t-row style="width: 100%">
            <t-col class="text-center" :flex="1" >发出份数</t-col>
            <t-col class="text-center" :flex="1">{{ formData.zfbmFc }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.hyxhFc }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.qyFc }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.kyjgFc }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.jyjcjgFc }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.rzrkjgFc }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.xfzdbFc }}</t-col>
          </t-row>
          <t-row style="width: 100%">
            <t-col class="text-center" :flex="1">收回份数</t-col>
            <t-col class="text-center" :flex="1">{{ formData.zfbmSh }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.hyxhSh }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.qySh }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.kyjgSh }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.jyjcjgSh }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.rzrkjgSh }}</t-col>
            <t-col class="text-center" :flex="1">{{ formData.xfzdbSh }}</t-col>
          </t-row>
        </t-col>
      </t-row>
      <t-row>
        <t-col class="text-center" style="font-weight: bold" :span="12">意见及处理情况</t-col>
      </t-row>
      <t-row>
        <t-col :span="12">
          <t-form-item name="handleSituations">
            <opinion-fixed-list ref="opinion-fixed-list"  v-model="formData.handleSituations"></opinion-fixed-list>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">备注</t-col>
        <t-col :span="10">
          <div>1.标准内容不涉及的单位类别，发出份数、收回份数可填“0”；</div>
          <div>2.意见及处理情况：所有意见均需填写。</div>
        </t-col>
      </t-row>
    </t-form>
  </div>
</template>

<script>
import opinionFixedList from "./opinion-fixed-list.vue";

export default {
  name: "opinion-detail",
  components:{
    opinionFixedList
  },
  data(){
    return {
      deptMenuOptions: [],
      formData: {
        localId: null,
        collectDate: '',
        planNum: '',
        projectName: '',
        zfbmFc: 0,
        zfbmSh: 0,
        hyxhFc: 0,
        hyxhSh: 0,
        qyFc: 0,
        qySh: 0,
        kyjgFc: 0,
        kyjgSh: 0,
        jyjcjgFc: 0,
        jyjcjgSh: 0,
        rzrkjgFc: 0,
        rzrkjgSh: 0,
        xfzdbFc: 0,
        xfzdbSh: 0,
        handleSituations: []
      },
      draftUnitId: null,
    }
  },
  props: {
    objId: [String, Number],
    reviewOpen: {
      type: Boolean,
      default: false
    },
  },
  watch: {
    objId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getObj(val);
        }
      }
    },
  },
  created() {
    this.getDeptTreeSelect();
  },
  methods: {
    getDeptTreeSelect() {
      return this.$api.system.dept.treeSelectAllIn().then(response => {
        this.deptMenuOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getObj() {
      this.$api.bzh.opinion.getBySuggestId(this.objId).then(response => {
        if (response.data.createUserId === Number(this.$store.state.user.userId)) {
          this.isMyProject = true;
        }
        Object.assign(this.formData, response.data);
      }).catch((e) => {
        this.$message.error(e.toString());
      });
      this.$api.bzh.standard.getApplyBySuggestId(this.objId).then(response => {
        this.formData.projectName = response.data.projectName;
        this.draftUnitId = response.data.draftUnits[0].unitId;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    }
  }
}
</script>

<style scoped>

</style>
